#include "stdafx.h"
#include "Light.h"


Light::Light(void)
{
	init();
}

Light::~Light(void) 
{
	delete[] mylight_position;
	delete[] mylight_color;
	delete[] mylight_direction;
}

void Light::init() 
{
	mylight_position = new GLfloat[4]; mylight_position[0] = 0; mylight_position[1] = 0; mylight_position[2] = 5; mylight_position[3] = 1;//mylight_position = new GLfloat[4]; mylight_position[0] = 0; mylight_position[1] = 0; mylight_position[2] = -10; mylight_position[3] = 1;
	mylight_color = new GLfloat[4]; mylight_color[0] = 0.9; mylight_color[1] = 0.9; mylight_color[2] = 0.9; mylight_color[3] = 1;//mylight_color = new GLfloat[4]; mylight_color[0] = 1; mylight_color[1] = 0.3; mylight_color[2] = 0.3; mylight_color[3] = 1;
	mylight_direction = new GLfloat[3];	mylight_direction[0] = 0; mylight_direction[1] = 0;	mylight_direction[2] = -1;//mylight_direction = new GLfloat[3];	mylight_direction[0] = 0; mylight_direction[1] = 0;	mylight_direction[2] = -1;
	mylight_type = 1;
}

void Light::use(void)
{
	glUniform4fv(ShaderManager::loc_mylight_position,1, mylight_position);
	glUniform4fv(ShaderManager::loc_mylight_color,1, mylight_color);
	glUniform3fv(ShaderManager::loc_mylight_direction ,1 ,mylight_direction);
	glUniform1i(ShaderManager::loc_mylight_type, mylight_type);
}